/*
 * Copyright (C) 2011 Jaytter Team
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/*
 * GenericTweetTimelinePanel.java
 *
 * Created on 29/06/2011, 00:15:19
 */
package org.jaytter.ui.panels.impl;

import java.awt.Insets;
import twitter4j.DirectMessage;
import twitter4j.ResponseList;
import twitter4j.Status;

/**
 *
 * @author Jaytter Team
 */
public abstract class GenericTweetTimelinePanel extends javax.swing.JPanel {

    protected int grid_current_x = 0;
    protected int grid_current_y = 0;
    protected int refreshTime = 120; // in seconds
    protected ResponseList<Status> cached;

    /** Creates new form GenericTweetTimelinePanel */
    public GenericTweetTimelinePanel(String name) {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        setLayout(new java.awt.GridBagLayout());
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

    protected void insertStatus(Status tweet) {
        grid_current_y++;

        GenericSingleTweetPanel p = new GenericSingleTweetPanel(tweet);

        java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = grid_current_y;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.ipadx = 320;
        gridBagConstraints.ipady = 30;
        gridBagConstraints.weightx = 20.0;

        gridBagConstraints.insets = new Insets(3, 3, 3, 3);
        add(p, gridBagConstraints);
    }

    protected void insertStatusDM(DirectMessage tweet) {
        grid_current_y++;

        GenericSingleTweetPanel p = new GenericSingleTweetPanel(tweet);

        java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = grid_current_y;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.ipadx = 320;
        gridBagConstraints.ipady = 30;
        gridBagConstraints.weightx = 20.0;

        gridBagConstraints.insets = new Insets(3, 3, 3, 3);
        add(p, gridBagConstraints);
    }

    public abstract void update();
    
    // TODO Fazer insertStatus() no topo do panel.
    // TODO Fazer insertStatusDM() no topo do panel.
}
